/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.sarco.bwi.lib.mysql;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

/**
 * Deprecated, use <code>com.sarco.bwi.lib.mysql.Mysql</code> instead.
 * @deprecated 0.0.2
 * @author iktsup
 */
public class Master {
    private Connection conn;
    private Statement stmnt;
    private ResultSet rs;

    public Master() {
        this.conn = null;
        this.stmnt = null;
        this.rs = null;
    }

    public void connect(String host,
            String user,
            String password,
            String database) {
        String connection = "jdbc:mysql://" + host + "/" + database + "?"
                + "user=" + user + "&password=" + password;
        try {
            this.conn = DriverManager.getConnection(connection);
            this.stmnt = conn.createStatement();
        } catch (SQLException ex) {
            System.out.println(ex.getMessage());
        } finally {
            // <editor-fold defaultstate="collapsed" desc="GC">
            try {
                if (this.rs != null) {
                    this.rs.close();
                }
                this.rs = null;
            } catch (SQLException ex) {
            }

            try {
                if (this.stmnt != null) {
                    this.stmnt.close();
                }

                this.stmnt = null;
            } catch (SQLException ex) {
            }

            try {
                if (this.conn != null) {
                    this.conn.close();
                }

                this.conn = null;
            } catch (SQLException ex) {
            }// </editor-fold>
        }
    }
}
